package com.xiaoniu.imclient.interceptors;

import com.google.gson.Gson;
import com.xiaoniu.lib_keleim.spi.IConverterFactory;

public class GsonConverterFactory implements IConverterFactory {

    Gson mGson;

    @Override
    public void create() {
        mGson = new Gson();
    }

    @Override
    public <T> T parse(String rawMessage, Class<T> typeOfT) {
        return mGson.fromJson(rawMessage,typeOfT);
    }

    @Override
    public String toRowData(Object src) {
        return mGson.toJson(src);
    }
}
